use std::fs::File;
use std::io::Read;
pub fn read_file(){
    let file:Result<File,std::io::Error>=File::open("C:/Repos/rust-demo/target/debug/Hello.txt");
    match file {
        Ok(mut file)=>{
            let mut contents=String::new();
            if  let Ok(bytes)=file.read_to_string(&mut  contents){
                println!("Dear diary:{contents} {bytes} bytes");
            }else { 
                println!("Could not read file content");
            }
        }
        Err(err)=>{
            println!("The diary could not be opened :{err}");
        }
    }
} 